Frome object to iframe--other embedding technologies
iframes in detail
<head>
<style>
iframe {
border: none;
}
</style>
</head>
<body>
<iframe
src="https://developer.mozilla.org/en-US/docs/Glossary"
width="100%"
height="500"
allowfullscreen
sandbox>
<p>
<a href="/en-US/docs/Glossary">
Fallback link for browsers that don't support iframes
</a>
</p>
</iframe>
</body>
<iframe>
border: none
默认有边界,去边界。
allowfullscreen
If set, the <iframe>
is able to be placed in fullscreen mode using the Fullscreen API
src
来源
width and height
长宽高
sandbox
Note: In order to improve speed, it's a good idea to set the iframe's src
attribute with JavaScript after the main content is done with loading. This makes your page usable sooner and decreases your official page load time
always use the sandbox
attribute
If absolutely required, you can add permissions back one by one (inside the sandbox=""
attribute value) — see the sandbox
reference entry for all the available options. One important note is that you should never add both allow-scripts
and allow-same-origin
to your sandbox
attribute — in that case, the embedded content could bypass the Same-origin policy that stops sites from executing scripts, and use JavaScript to turn off sandboxing altogether.
The <embed>
and <object>
element
<embed>
<object>
<embed> | <object> | |
---|---|---|
URL of the embedded content | src | data |
accurate media type of the embedded content | type | type |
height and width (in CSS pixels) of the box controlled by the plugin | height width | height width |
names and values, to feed the plugin as parameters | ad hoc attributes with those names and values | single-tag <param> elements, contained within <object> |
independent HTML content as fallback for an unavailable resource | not supported (<noembed> is obsolete) | contained within <object> , after <param> elements |
<object dataj= "mypdf.pdf" type= "application/pdf" width ="800" height ="1200">
<p>
You don't have a PDF plugin, but you can
<a href= "mypdf.pdf">download the PDF file. </a>
</p>
</object>